<template>
  <div class="container">
    <div class="app-container">
      <el-button class="btn-add" size="mini" type="primary">添加权限</el-button>
      <el-table :data="tableDate" row-key="id">
        <el-table-column label="名称" prop="name" />
        <el-table-column label="标识" prop="code" />
        <el-table-column label="描述" prop="description" />
        <el-table-column label="操作">
          <template #default="{row}">
            <el-button v-if="row.type===1" size="mini" type="text">添加</el-button>
            <el-button size="mini" type="text">编辑</el-button>
            <el-button size="mini" type="text">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
import { reqGetPermission } from '@/api/permission'
import { translateTreeData } from '@/utils/index'
export default {
  name: 'Permission',
  data() {
    return {
      tableDate: []
    }
  },
  created() {
    this.getPermission()
  }, methods: {
    async  getPermission() {
      const res = await reqGetPermission()
      console.log(res)
      this.tableDate = translateTreeData(res.data, 0)
    }
  }
}
</script>
<style>
.btn-add {
  margin: 10px;
}
</style>
